#!/sbin/openrc-run

description="HEP Capture Server & Switch"
supervisor=supervise-daemon
command=/usr/bin/heplify-server
command_args="-config /etc/homer/heplify-server.toml"
command_user=homer
command_group=homer
pidfile="/run/homer/${RC_SVCNAME}.pid"
extra_started_commands=reload

depend() {
	need net
	after firewall postgresql
}

start_pre() {
	checkpath --directory --owner $command_user:$command_group ${pidfile%/*}
}

reload() {
	ebegin "Reloading PromTargetIP and PromTargetName in ${RC_SVCNAME} configuration"
	${supervisor} ${RC_SVCNAME} --signal HUP
	eend $?
}

